package com.multi.thread.chapter03.demo08;

/**
 *	wait等待的条件发生了变化，也容易造成 程序逻辑的混乱
 */
public class Run {
	
	public static void main(String[] args) throws InterruptedException {
		String lock = new String("");
		
		Add add = new Add(lock);
		Subtract subtract = new Subtract(lock);
		
		ThreadSubtract subtractThread1 = new ThreadSubtract(subtract);
		subtractThread1.setName("subtractThread1");
		subtractThread1.start();
		
		ThreadSubtract subtractThread2 = new ThreadSubtract(subtract);
		subtractThread2.setName("subtractThread2");
		subtractThread2.start();
		
		Thread.sleep(1000);
		
		ThreadAdd threadAdd = new ThreadAdd(add);
		threadAdd.setName("addThread");
		threadAdd.start();
	}

}
